package itheima.chap08;

public class VariadicParameter {
    public static void main(String[] args) {
        System.out.println(add(10, 20, 30, 40, 50));
        System.out.println(add(0, 10,20, 30,40,50));
    }

    // 定义一个方法，求任意多个整数的和(数组)
    public static int add(int a,int ... nums){
        int sum = 0;
        for(int i = 0;i < nums.length;i++){
            sum += nums[i];
        }
        return sum;
    }
}
